package boogui.movie;

import java.util.List;
import java.util.Scanner;

public class MovieService implements IMovieService {

	IMovieDAO mvdao = null;

	Scanner scan = new Scanner(System.in);

	public MovieService() {
		mvdao = new MovieDAO();
	}

	@Override
	public void createMovie() {
		MovieVO mv = new MovieVO();
		System.out.println("영화 제목 입력");
		mv.setMovtitle(scan.next());

		System.out.println("영화 장르 입력");
		mv.setMovgenre1(scan.next());
		mv.setMovgenre2(scan.next());

		System.out.println("영화 감독 입력");
		mv.setMovdirector(scan.next());

		System.out.println("영화 배우 입력");
		mv.setMovactor1(scan.next());
		mv.setMovactor2(scan.next());
		mv.setMovactor3(scan.next());

		System.out.println("영화 등급 입력");
		mv.setMovrating(scan.next());

		System.out.println("영화 줄거리 입력");
		mv.setMovsynop(scan.next());

		System.out.println("영화 런닝타임");
		mv.setMovruntime(scan.next());

		System.out.println("영화 개봉일 입력");
		mv.setMovplaydate(scan.next());

		System.out.println("영화 개봉여부 입력");
		mv.setMovisplay(scan.next());

		if (mvdao.insertMovie(mv))
			System.out.println("가입");
		else
			System.out.println("실패");

	}

	@Override
	public void readMovie() {
		/*
		 * for (MovieVO mv : mvdao.selectMovie()) {
		 * 
		 * }
		 */
	}

	@Override
	public void modifyMovie() {
		MovieVO mv = new MovieVO();

		System.out.println("변경할 영화 번호 입력");
		mv.setMovno(scan.next());
		System.out.println("변경할 제목 입력");
		mv.setMovtitle(scan.next());

		if (mvdao.modifyMovie(mv)) {
			System.out.println("수정");
		} else {
			System.out.println("실패");
		}
	}

	@Override
	public void removeMovie() {
		MovieVO mv = new MovieVO();
		System.out.println("삭제할 번호 입력");
		mv.setMovno(scan.next());
		if (mvdao.deleteMovie(mv)) {
			System.out.println("삭제완료");
		} else {
			System.out.println("삭제실패");
		}

	}

	@Override
	public void searchmovie(MovieVO m) {

		mvdao.selectMovie(m);

	//	m.setMovdirector(m.getMovdirector());

	}
}